package cn.itsource.ymcc.schedue;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
@Configuration
@EnableScheduling //开启同步线程
@EnableAsync //异步线程
public class TestSchedule {

//    @Scheduled(cron = "0/5 * * * * ?"
//            /*initialDelay=3000,//延迟三秒执行
//            fixedRate=5000  //每5秒执行一次*/
//    ) //双11的时候执行
//    @Async  //异步执行
//    public void testJob() {
//        try {
//            Thread.sleep(3000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//        //发布活动
//        String name = Thread.currentThread().getName();
//        System.out.println("冲冲冲" + name);

//    }
}
